1. Field of the invention
The present invention relates to computer systems, and more particularly, to virtual machine systems which provide for instruction processing in multiple levels of virtual machines. More particularly, this invention relates to efficient emulation of one or more guest architectures in a multi-programmable computer system to improve the performance of the system when executing plural levels of operating systems.
2. Description of the Prior Art
Mainframe computer systems such as the IBM 3090 computer system comprise a plurality of processors and large random access and sequential access storage devices. These large systems are capable of processing a large number of tasks in a short period of time. It is frequently desirable to divide this host processing power into separate partitions or "virtual machines" that can be operated by different users. The division is accomplished by the use of host control program software such as the IBM Virtual Machine/Extended Architecture (VM/XA) system product or a facility such as the IBM PR/SM hardware partitioning feature. Each of the virtual machines defined above can accept a "guest" operating system that may be different from the host operating system. Thus, for example, if the host is running the VM/XA operating system, the guest could operate the IBM MVS/XA system program. The guest virtual machines may in turn be divided into additional virtual machines for performance of certain tasks.
The host control program or operating system is typically referred to as the host and the guest operating on the host is the guest. Guest programs believe they are causing a real access to a processor or memory. The IBM System/370 architecture manages this through a process known as interpretive execution of the virtual machine instructions. The System/370 architecture is described in the IBM Publication GA22-7000. The IBM System/370-XA implementation of interpretive execution is described in IBM Publication SA22-7095.
Interpretive execution requires the translation of instructions and addresses from the guest machine to the underlying real machine and real storage. An example of the translations required is the translation of memory addresses from the guest machine to real storage. U.S. Pat. No. 4,456,954, issued on Jun. 26, 1984 and assigned to the assignee of this application, describes interpretive execution and address translation under interpretive execution and is incorporated herein by reference.
The host machine initiates a guest program through a Start Interpretive Execution (SIE) instruction. The SIE instruction invokes interpretive execution hardware in the host causing the host to enter interpretive execution mode for executing the guest. SIE provides for the mapping of addresses by the guest virtual machine.
Each virtual machine to be operated as a guest of the host machine is described in a state description maintained in real storage. When an SIE instruction is encountered, the state description is used to establish the virtual machine environment for execution., At the same time, the existing host environment must be saved so it can be restored upon exit from the virtual machine. Upon completion of the SIE instruction (including running of the guest), the current status of the guest virtual machine must be stored in the state description and the previous host environment restored to the real machine. This saving and restoring control information creates a large amount of overhead which is particularly harmful to performance when the actual execution time for the guest virtual machine is relatively short.
Among the interpretive execution facilities are dynamic address translation and guest timing services. Dynamic address translation is the process which translates a guest virtual address into a host real address allowing access to the real storage in the machine. The IBM System/370 employs a virtual memory mechanism in which real memory is divided into pages of a constant size, e.g., 4K bytes, which are addressed by segment and page indices. The virtual address of a memory location will be represented as a segment table index value, a page table index value, and a displacement within the page. To locate the actual data, the segment table, page table, and memory page must each be accessed. If the virtual address is specified in a guest operating system, the address that guest believes to be a real address must be further translated by the lower level guests and the host machine. As a result, several steps of address translation must occur as shown by the arrows in FIG. 4a.
Address translation can be made more efficient by the use of a translation lookaside buffer (TLB). The translation lookaside buffer captures the results of dynamic address translation and provides a shortcut for future guest address translations. The TLB has a limited capacity, so only a certain number of recent translations are maintained (e.g., 512). The System/370 hardware provides the ability to test whether or not a translation from virtual to real for the virtual address request is available in the TLB. If the translation is available, it is used and dynamic address translation is bypassed. This can result in significant time savings. The translation lookaside buffer maintains several pieces of information including an indicator of whether the entry is for the host system or a guest, the logical address translated (representing a guest virtual or guest real address), the real address that resulted from the translation, and the segment table origin (STO) address of the logical address.
A second facility provided by interpretive execution is guest timing. The System/370 architecture provides host timing facilities including a clock comparator, CPU timer and time-of-day (TOD) clock. The host operating system can measure differences in time by simply comparing the clock at different points in time. Guest operating systems, however, must account for the periods of time when a different guest has control of the real machine resources. This accounting involves the maintenance of timing intervals and timing comparators. This interpretive execution facility also creates high overhead particularly where the interpretive execution guest machine is operating only for short periods of time.